Xbasic

UN_PAREN Function

Syntax

Output_String as C = un_paren(C string )

Arguments

string

A string expression containing parentheses. Character

Description

Removes unnecessary enclosing parentheses from an expression. If paren are unbalanced, returns string

Discussion

UN_PAREN() creates a character string by removing unnecessary pairs of open and close parentheses. If the string has unbalanced parentheses, the function returns the original string.

Example

un_paren("(a = 1) .and. (b = 2?)") -> "(a = 1) .and. (b = 2)"
un_paren("(((a = 1) .and. (b = 2)") -> "(((a = 1) .and. (b = 2)"

See Also